package org.meb.conquest.db.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Version;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import org.meb.conquest.db.model.loc.Card;

@Getter
@Setter
@ToString
@Entity
@Table(name = "cqt_deck")
public class Deck {

	private Integer configCsQuantity;
	
	private String name;
	private String description;
	private Date createDate;
	private Date modifyDate;
	private Long userId;

	@ManyToOne
	@JoinColumn(name = "warlord_id")
	private Card warlord;

	@OneToMany(mappedBy = "deck", cascade = CascadeType.ALL, orphanRemoval = true)
	private Set<DeckMember> deckMembers = new HashSet<DeckMember>();

	@Version
	private Long version;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
}
